<template>
    <div id="liveRoomAuthentication">
        <header>
            <i @click="goBack()"></i>
            <div>直播间认证</div>
        </header>
        <ul>
            <li>
                <a>
                  <i>手机号:</i>
                  <input type="text" placeholder="请输入手机号" v-model="phone"  @input="checkNum" @blur='testPhone' required />
                </a>
            </li>
            <li>
                <a>
                  <i>验证码:</i>
                  <input type="text" placeholder="请输入验证码" v-model="code" required @click="testPhone" />
                  <span>获取验证码</span>
                </a>
            </li>
            <li>
                <a class='no-border'>
                  <i>密&nbsp;&nbsp;&nbsp;&nbsp;码:</i>
                  <input type="password" placeholder="请设置密码" v-model="pass" required />
                </a>
            </li>
            <li>
                <a class='no-border'>
                  <i>请选择您的身份:</i>
                </a>
            </li>
            <li>
              <label>
                <img src="../../image/icon_lecturer.png" width='50' height='50' alt="">
                <div>
                  <input type="radio" v-model='status' value='讲师'>
                  <span></span>
                  讲师
                </div>
              </label>
              <label>
                <img src="../../image/icon_mechanism.png" width='50' height='50' alt="">
                <div>
                  <input type="radio" v-model='status' value='机构'>
                  <span></span>机构
                </div>
              </label>
            </li>
        </ul>
        <a class="sureBtn">
          保 存
        </a>
  </div>
</template>
<script>
  export default {
      data() {
          return {
              phone: '',
              code: '',
              pass: '',
              status: '讲师'        //讲师  机构
          }
      },
      components: {

      },
      methods: {
          goBack() {
              this.$router.back();
          },
          //校验手机号
          checkNum(e){
              var value = e.target.value;
              e.target.value = value.replace(/[^\d]/g, '');
              this.phone = e.target.value;
          },
          testPhone(){
              if (this.phone == "") {
                  this.$utils._toast("手机号不能为空");
                  return false;
              } else if (!/^1(3|4|5|7|8|9)\d{9}$/.test(this.phone)) {
                  this.$utils._toast("手机号码有误，请重填");
                  return false;
              }
          },
      },
      created() {
          // this.$api.get("topics", null, r => {
          // 	console.log(r);
          // 	this.list = [1,2,3];
          // })
      },
      mounted() {

      }
  }
</script>
<style lang="scss">
</style>
